package com.sdx.console.tdcard.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ibeetl.admin.core.entity.BaseEntity;
import com.ibeetl.admin.core.util.ValidateConfig;
import com.sdx.common.utils.Utils;
import lombok.Data;
import org.beetl.sql.core.annotatoin.AutoID;
import org.beetl.sql.core.annotatoin.ColumnIgnore;
import org.beetl.sql.core.annotatoin.Table;

import javax.validation.constraints.NotNull;
import java.util.Date;

/* 
* 
* gen by Spring Boot2 Admin 2019-11-20
*/
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@Data
@Table(name="cmsv6.t_d_card")
public class TDCard extends BaseEntity{

    @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
    @AutoID	
    private Long id ;
	
    private String password ;
	
    private Integer provinceId ;
	
    private Integer groupId ;
	
    //是否激活
    private Integer isActive ;
	
    //激活时间
    private Date activeDate ;
	
    //制卡时间
    private Date createDate ;
	
    //龙卡失效时间
    private Date inactiveDate ;
	
    private Integer channelUserId ;
	
    private Integer optUserId ;
	
    private String remark ;
	
    //绑定用户ID
    private String bindUserId ;
	
    private Integer outchannel ;
	
    private Integer fee ;
	
    private Integer isbalance ;
	
    //是否出库：1出库、0未出库
    private Integer status ;

	private Long idStart ;

	private Long idEnd ;

	@ColumnIgnore
	@JsonIgnore
	private String activeDateQuery;
	@ColumnIgnore
	@JsonIgnore
	private Date activeDateStart;
	@ColumnIgnore
	@JsonIgnore
	private Date activeDateEnd;
	public String getActiveDateQuery(){
		return  activeDateQuery;
	}
	public void setActiveDateQuery(String activeDateQuery ){
		this.activeDateQuery = activeDateQuery;
		Date[] timePair = Utils.parseQueryTime(activeDateQuery);
		if (timePair!=null && timePair[0]!=null) {
			this.activeDateStart = timePair[0];
		}
		if (timePair!=null && timePair.length==2 && timePair[1]!=null) {
			this.activeDateEnd = timePair[1];
		}

	}
	public Date getActiveDateStart(){
		return  activeDateStart;
	}
	public void setActiveDateStart(Date activeDateStart ){
		this.activeDateStart = activeDateStart;
	}
	public Date getActiveDateEnd(){
		return  activeDateEnd;
	}
	public void setActiveDateEnd(Date activeDateEnd ){
		this.activeDateEnd = activeDateEnd;
	}
	@ColumnIgnore
	@JsonIgnore
	private String createDateQuery;
	@ColumnIgnore
	@JsonIgnore
	private Date createDateStart;
	@ColumnIgnore
	@JsonIgnore
	private Date createDateEnd;
	public String getCreateDateQuery(){
		return  createDateQuery;
	}
	public void setCreateDateQuery(String createDateQuery ){
		this.createDateQuery = createDateQuery;
		Date[] timePair = Utils.parseQueryTime(createDateQuery);
		if (timePair!=null && timePair[0]!=null) {
			this.createDateStart = timePair[0];
		}
		if (timePair!=null && timePair.length==2 && timePair[1]!=null) {
			this.createDateEnd = timePair[1];
		}

	}
	public Date getCreateDateStart(){
		return  createDateStart;
	}
	public void setCreateDateStart(Date createDateStart ){
		this.createDateStart = createDateStart;
	}
	public Date getCreateDateEnd(){
		return  createDateEnd;
	}
	public void setCreateDateEnd(Date createDateEnd ){
		this.createDateEnd = createDateEnd;
	}
	@ColumnIgnore
	@JsonIgnore
	private String inactiveDateQuery;
	@ColumnIgnore
	@JsonIgnore
	private Date inactiveDateStart;
	@ColumnIgnore
	@JsonIgnore
	private Date inactiveDateEnd;
	public String getInactiveDateQuery(){
		return  inactiveDateQuery;
	}
	public void setInactiveDateQuery(String inactiveDateQuery ){
		this.inactiveDateQuery = inactiveDateQuery;
		Date[] timePair = Utils.parseQueryTime(inactiveDateQuery);
		if (timePair!=null && timePair[0]!=null) {
			this.inactiveDateStart = timePair[0];
		}
		if (timePair!=null && timePair.length==2 && timePair[1]!=null) {
			this.inactiveDateEnd = timePair[1];
		}

	}
	public Date getInactiveDateStart(){
		return  inactiveDateStart;
	}
	public void setInactiveDateStart(Date inactiveDateStart ){
		this.inactiveDateStart = inactiveDateStart;
	}
	public Date getInactiveDateEnd(){
		return  inactiveDateEnd;
	}
	public void setInactiveDateEnd(Date inactiveDateEnd ){
		this.inactiveDateEnd = inactiveDateEnd;
	}

}
